<extend name="extends/extend" />
<block name="loadCss">
    <!--美化 checkbox radio css-->
    <link href="__admin__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/public/simditor/styles/simditor.css">
</block>
<block name="script">
    <!--表单验证 插件-->
    <script src="__admin__/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="__admin__/js/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="/static/public/simditor/scripts/module.js"></script>
    <script type="text/javascript" src="/static/public/simditor/scripts/hotkeys.js"></script>
    <script type="text/javascript" src="/static/public/simditor/scripts/uploader.js"></script>
    <script type="text/javascript" src="/static/public/simditor/scripts/simditor.js"></script>
    <script>
        $(document).ready(function () {
            var editor = new Simditor({
                textarea: $('#editor'),
                upload:{
                    url: '/admin/files/editor',
                    params: {rule:'img'},
                    fileKey: 'upload_file',
                    connectionCount: 3,
                    leaveConfirm: 'Uploading is in progress, are you sure to leave this page?'
                },
                pasteImage:true, //支持上传图片从剪贴板粘贴。

            });
            $('#checkForm').validate({
                submitHandler:function(form) {
                    form.submit();
                },
                highlight: function(e) {
                    $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
                },
                success: function(e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                errorClass: "help-block m-b-none",
            });
        });
    </script>
</block>
<block name="content">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>
                            <i class="glyphicon glyphicon-log-out"></i>
                            <volist name="parents" id="v">
                                <a href="{$v['url']}">{$v['name']}</a> <em class="glyphicon glyphicon-menu-right"></em>
                            </volist>
                        </h5>
                        <div class="ibox-tools">
                            <a href="javascript:location.reload(true);" class="btn btn-outline btn-info btn-xs">
                                <i class="fa fa-refresh"></i> 刷新
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="" class="form-horizontal" id="checkForm">
                            <notempty name="childColumn">
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <div class="alert alert-warning">
                                                <h3 style="margin: 0;">子栏目:</h3>
                                                <div class="hr-line-dashed" style="margin: 10px 0"></div>
                                                <volist name="childColumn" id="v">
                                                    <a href="{$v['url']}" class="btn btn-success btn-sm">{$v['name']}</a>
                                                </volist>
                                            </div>
                                        </div>
                                    </div>
                            </notempty>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">摘要</label>
                                <div class="col-sm-10">
                                    <textarea  name="description" required class="form-control">{$page['description']}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">内容</label>
                                <div class="col-sm-10">
                                    <textarea  name="content" id="editor" required class="form-control">{$page['content']}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    {:token()}
                                    <button class="btn btn-primary" type="submit">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>